#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#include <string.h>

typedef struct student
{
    char name[20];
    int age;
    double score;
}stu;

void* func(void* arg){
    int n = 0;
    stu* str = (stu*)arg;
    while (1)
    {
        printf("接受到参数：%s %d %lf\n",str->name,str->age,str->score);
        printf("分支线程：%d\n",n++);
        sleep(1);
    }
}

void* func2(void* arg){
    int n = 0;
    stu* str = (stu*)arg;
    while (1)
    {
        printf("接受到参数：%s %d %lf\n",str->name,str->age,str->score);
        printf("分支线程：%d\n",n++);
        sleep(1);
    }
}

int main()
{
    int n = 0;
    int m = 666;
    pthread_t pt;
    pthread_t pt1;
    stu s ={"xoaow",1,2.00};


    pthread_create(&pt,NULL,func,&s);
    pthread_create(&pt1,NULL,func2,&s);
    printf("pt:%lu\n",pt);
    printf("pt:%lu\n",pt1);

    while (1)
    {
        printf("主线程：%d\n",n++);
        sleep(1);
    }


    return 0;
}
